package com.tone.ji_volunteer.controller;

import com.tone.ji_volunteer.pojo.Code;
import com.tone.ji_volunteer.pojo.Result;
import com.tone.ji_volunteer.service.LoginService;
import com.tone.ji_volunteer.util.WxLogin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import cn.hutool.http.HttpUtil;
import java.util.Map;


/**
 * @author tone(ang)
 * version 1.0
 */
@RestController
public class LoginController {
    @Autowired
    private LoginService loginService;

    @PostMapping("/login")
    public Result login(@RequestBody Map<String, Object> body){
        //System.out.println(body);
        Map<String, Object> code = (Map<String, Object>) body.get("query");
        String login = loginService.login(code);
        return Result.success(login);
    }
}
